<template>
  <div class="components-input-demo-presuffix">
    <label-base v-show="showLabel">{{ label }}</label-base>
    <a-input v-model:value="seed" placeholder="随机种子">
      <template #suffix>

        <a-tooltip title="随机种子">
<!--          <v-btn size="x-small" @click="seed=ComfyUI.getSeed(9)" icon="mdi-dice-multiple" />-->
<!--          <Icon icon="mdi:email" :inline="true"></Icon>-->
<!--          <info-circle-outlined  style="color: rgba(255, 255, 0, 0.45)" />-->
          <Icon @click="seed=ComfyUI.getSeed(length)" name="ion:dice" />
        </a-tooltip>
      </template>
    </a-input>
  </div>

</template>
<script lang="ts" setup>
// import { Icon, disableCache, addIcon } from '@iconify/vue';
import { UserOutlined, InfoCircleOutlined } from '@ant-design/icons-vue';
import { ref } from 'vue';
import LabelBase from "~/components/ai/LabelBase.vue";

// const seedHistories = ref<number[]>([]);
// const seedIndex = ref(0);
interface Prop{
  length?:number
  showLabel?:boolean
  label?:string
}
const props = withDefaults(defineProps<Prop>(),{
  length:9,
  showLabel:true,
  label:"随机种子"
})
const seed=defineModel({
  default:0,
})

const getSeed = () => {
  seed.value=ComfyUI.getSeed(props.length)
}

defineExpose({
  getSeed,
})

// const handleChooseLastSeed =()=>{
//   seedIndex.value=seedIndex.value>seedHistories.value.length-1?0:seedIndex.value+1
//   seed.value=seedHistories.value[seedIndex.value]
// }
onMounted(()=>{
  getSeed()
})
</script>

